1. Field of the Invention
The present invention relates to web browsers. More specifically, the present invention relates to a method and an apparatus for executing scripts within a web browser.
2. Related Art
As web applications become increasingly complex, scripting systems are often used to handle some of the more complex tasks. However, scripting systems are presently defined as single-threaded systems with sequential event models. This means that one event handler must return before the next event handler will execute.
This single-threaded model creates problems for complex web applications. For example, during the execution of a time-consuming operation, such as a heavy computational operation or a large input/output operation, the time-consuming operation will block all subsequent operations on the page. In some cases, this blocking can lead a user to believe that his or her browser has locked up. Furthermore, in some web browsers, the time-consuming operation will also block every other page which is open in a tab or window in the same browser process.
In order to alleviate this problem, some scripting systems allow an application to manually split large operations into smaller units. This allows an associated script engine to yield to a central manager after each of the smaller units. However, splitting large operations into smaller units is tedious and difficult, and requires additional bookkeeping, which can cause a significant performance degradation.
Hence, what is needed is a method and an apparatus for executing time-consuming operations within a browser without the problems listed above.